﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Mapping.Attributes;

namespace BidFunLib.Entity
{
    /// <summary>
    /// 
    /// </summary>
    [Class(Lazy=true)]
    public class BidObject
    {
        /// <summary>
        /// Technical Identifier  
        /// </summary>
        [Id(Name = "IdBidObject")] [Generator(Class = "native")] 
        virtual public Int32 IdBidObject { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [Property]
        virtual public String RealPrice { get; set; }

        /// <summary>
        /// 
        /// </summary>
        virtual public Double RealPriceAsDouble 
        {
            get
            {
                Double res = 0;
                if (RealPrice != null)
                {
                    Double.TryParse(RealPrice.Replace(".", ",").Replace("€", ""), out res);
                }
                return res; 
            }
            set
            {
                RealPriceAsDouble = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [Property]
        virtual public String Label { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public BidObject()
        {
            Label = "";
            RealPrice = "0";
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="label"></param>
        public BidObject(String label)
        {
            Label = label;
            RealPrice = "0";
        }
    }

}
